import request from '@/config/axios'

export interface TenantVO {
  id: number
  name: string
  contactName: string
  contactMobile: string
  status: number
  domain: string
  packageId: number
  username: string
  password: string
  expireTime: Date
  accountCount: number
  createTime: Date
}
export interface TenantVOS {
  id: number
  name: string
  contactName: string
  contactMobile: string
  status: number
  domain: string
  packageId: number
  username: string
  password: string
  expireTime: Date
  createTime: Date
  callNumber: number
}
export interface TenantPageReqVO extends PageParam {
  name?: string
  contactName?: string
  contactMobile?: string
  status?: number
  createTime?: Date[]
}

export interface TenantExportReqVO {
  name?: string
  contactName?: string
  contactMobile?: string
  status?: number
  createTime?: Date[]
}

// 查询租户列表
export const getTenantPage = (params: TenantPageReqVO) => {
  return request.get({ url: '/system/tenant/page', params })
}
// 查询租户select
export const getTenantSimple = () => {
  return request.get({ url: '/system/tenant/simple-list' })
}
// 查询租户详情
export const getTenant = (id: number) => {
  return request.get({ url: '/system/tenant/get?id=' + id })
}

// 新增租户
export const createTenant = (data: TenantVO) => {
  return request.post({ url: '/system/tenant/create', data })
}

// 修改租户
export const updateTenant = (data: TenantVO) => {
  return request.put({ url: '/system/tenant/update', data })
}

// 删除租户
export const deleteTenant = (id: number) => {
  return request.delete({ url: '/system/tenant/delete?id=' + id })
}

// 导出租户
export const exportTenant = (params: TenantExportReqVO) => {
  return request.download({ url: '/system/tenant/export-excel', params })
}

// 获取租户简要信息
export const getSimpleInfo = () => {
  return request.get({ url: '/system/tenant/simple-info' })
}

// 获取租户的套餐列表
export const getPackageList = (params) => {
  return request.get({ url: '/system/tenant-product/page', params })
}

// 获取管理员租户的套餐列表
export const getPackageListBySystem = (params) => {
  return request.get({ url: '/system/tenant-product/page-by-system', params })
}

// // 住户账户查询
// export const getAccout = (id: number) => {
//   return request.get({ url: '/system/tenant/get-account?id=' + id })
// }

// // 编辑租户账户
// export const updateAccout = (data: TenantVOS) => {
//   return request.put({ url: '/system/tenant/update-account', data })
// }
//跳转租户
export const jumpLogin = (id) => {
  return request.get({ url: '/system/tenant/jump-login?id=' + id })
}
// sip主叫分组list
export const getCidGroup = () => {
  return request.get({ url: '/call/account/get-cid-group' })
}

// ========================== 2025年1月7日 =======================//
// 获取代理商列表
export const getProxyManagerList = () => {
  return request.get({ url: '/system/tenant/get-proxy-manager-list' })
}
